Copyright: Alessandro Oddera Software


Contents
DataDuck: PowerScript language reference manual

Introduction:

Basic concepts

Plugin names and location

Field names and predefined variables names

User variables name

Headers

For beginners...

Write your first Plugin

Some easy examples

Reference...

Language Reference


Working Folder is currently opened folder. All files in Working Folder are managed like one single file. You can search in all files in Working Folder, or print multiple files with only one command.

You can switch from Working Folder with the command Change Working Folder, or with the quick command Recent Folder.


Language Reference
 Language References

Alphabetical order

Attributes

Comments

Logical Conditions

C_AddButton

C_Add

C_Beep

C_Begin

C_CallScript

C_CloseDosFile

C_CopyDosFile

C_Copy

C_DecDate

C_DisableEsc

C_Div

C_Else

C_EnableEsc

C_End

C_Exec

C_FlyMessageBox

C_ForEach

C_GetAppWindow

C_Goto

C_Halt

C_HideWindow

C_If

C_Imp

C_ImportFile

C_ImportFixChar

C_IncDate

C_InitVar

C_Label

C_MessageBar

C_MessageBox

C_Mul

C_NullCommand

C_OpenDosFile

C_OpenFile

C_PostFile

C_PostMessage

C_PrintDosFile

C_ReadDosFile

C_RedrawWindow

C_Reindex

C_SaveFile

C_SearchAll

C_Search

C_SetBarBmp

C_SetButtBmp

C_SetFieldAttr

C_SetFieldColor

C_SetField

C_SetFocus

C_SetGlbFieldAttr

C_SetGlbFieldColor

C_SetGlbFieldDef

C_SetRecAttr

C_SetRecColor

C_SetRedraw

C_SetSelIndexl

C_SetSelNext

C_SetSelPrev

C_SetSelUniqueID

C_SetSortField

C_SetVar

C_SetWindowCaller

C_ShowWindow

C_Spaces

C_StoreUniqueFileName

C_Sub

C_TraceCall

C_Trace

C_TraceLink

C_WaitFile

C_Wait

C_WaitMessage

C_While

C_WriteDosFile

F_Address

F_AllRList

F_Birth

F_Company

F_Lastname

F_Memo

F_Name

F_NullField

F_RList

F_RListLabel

F_Title

F_UnqueID

F_UnSort

F_Zip

P_AskFileOpen

P_AskFileSave

P_AskString

P_Break

P_FirstItem

P_GetDateCurrent

P_GetDateCurrentYear

P_GetDateDay

P_GetDateDayName

P_GetDateDayOfWeek

P_GetDateDayOfWeekInt

P_GetDateDayOfYear

P_GetDateFormat

P_GetDateMonth

P_GetDateMonthInt

P_GetDateSeparator

P_GetDateYear

P_GetFieldAttr

P_GetMoonInfo

P_GetVar

P_IsDateBisestile

P_LastItem

P_MessageBox

P_StrChar

P_StrDel

P_StrInsert

P_StrLen

P_StrPos

P_StrRev

P_StrStr

P_StrTrunc

P_UniqueFileName

S_CR

S_LF

S_NL

S_SP

T_Address

T_Birth

T_ButtAdd

T_ButtPhone

T_Company

T_Lastname

T_MainList

T_Memo

T_Name

T_RListList

T_SortAddress

T_SortLastname

T_SortLocked

T_SortMemo

T_SortName

T_SortTitle

T_SortUniqueID

T_Title

T_Zip

V_AppDir

V_CurUserDir

V_CurUser

V_FileName

V_GetCount

V_GetRListCount

V_GetSelIndex

V_GetSelRListIndex

V_LastUniqueID

V_ThisDir

W_Left

W_Right


Beginners
 Write you first plugin...

To write a plugin is easy and nice.

Everybody can write a DataDuck plugin.

Q. What should I know to be able to write a plugin?

R. 	1) You should know the use of Notepad, or another pure text editor.

2) You should know what is a file, a file name, and what is a folder.

Your first plugin:

Now we will create a plugin that will put an useful application (Windows Calculator) inside DataDuck Plugin menu, so we will can easily launch it.

1) Open Notepad, or your favorite editor, with a new document.

Write the following lines in the document:

H_MenuTitle  Calculator

H_MenuHelp Lauch the Calculator

  C_Begin

  C_Exec Calc

  C_End

2) Now save the file in the DataDuck plugin folder, usually it will be:

C:\Programs\DDuck\Plugin

or

C:\Soft\DDuck\Plugin

Give to the file the name you like i.e Calc, with extension .PLU

Calc.PLU

NOTE: If you use Notepad in Windows 95, you must double quote the name, else Notepad will add the extension .TXT to the name, and it will save a file named Calc.PLU.Txt, to avoid this problem you can tell Notepad to save a file named:

"Calc.PLU"

If you use a word processor, like MSWord, you should save the file like a pure Text File, not like a Word document, see file format in Save As dialog of your word processor.

3) Now start DataDuck, if you have DataDuck open, close and restart it (so it will update the plugin list), and you will see a new Menu item under Plugin menu, and under Plugin Button, it will be named Calculator (the first line of your plugin); take a look at the message bar (the line at the bottom of DataDuck window), you will see the sentence: Lauch the Calculator (the second line of your plugin)

4) Click the new Menu item (Calculator), the calculator will be launched.

Congratulations!

You have wrote your first plugin.

If you like you can write some other plugins for other frequently used applications, if you do so, may be you like to structure your plugins, this is easy.

You can create a subfolder under plugin folder, and put some plugins inside it, i.e. you can create a folder named:

...\DDuck\Plugin\Accessories

and move the plugin Calc.PLU inside it, then close and restart DataDuck, you will see a Popup menu under Plugin menu (a Popup menu is a submenu) named Accessories, with your plugins inside it.


Beginners
 Some easy examples

Example 1  Output all records in Notepad file.

Example 2  Output all records, and print with MSWord.

Example 3  Output filtered records in Notepad file.

Example 4  Create envelopes.

Example 5  Using variables.

Example 6  Logical Conditions.

Example 7  Export-Import.


 Basic concepts

With a plugin you can change the behaviour of DataDuck, and transform it in another program.

The PowerScript language is so easy that the beginners could use it, the PowerScipt language is powerful enough to construct professional applications.

A plugin is composed from: at least one text file containing commands written in PowerScript language; and from other optional modules.

A plugin can be only one text file, with no other module.

A plugin allow the costruction of a program that can work with DataDuck.

Other module are usually executable programs written with another language, they can perform operations not allowed in PowerScript language. There are a lot of Synchronization functions that allow an external module to get and put data in DataDuck synchronously.

Since DataDuck allow the External Links, one of more often used module can be a MSWord macro, the print functions of DataDuck itself are based on MSWord basic macro

The plugin basic syntax is based on C_ V_ F_ beginning words.

Any commands start with C_ , like C_Copy

The C_ is the line separator, you can't nest two C_ commands, i.e.

C_SetVar (st, First string) 	C_SetVar (st2, Second string)

the above line will be interpreted like two lines

// the followin line is WRONG

C_SetVar (st, C_SetVar(st2, Hello world) )

the above line will be breaked so:

C_SetVar (st,

C_SetVar(st2, Hello world) )

PowerScript don't make use of string delimiter like ", often this make the work more easy for the beginners, they must not writle line like:

"Name is: ", F_Name, "; Lastname is: ", F_Lastname, "; age is: ", V_Age, "."

in PowerScript language the above line will become more clear:

Name is: F_Name; Lastname is: F_Lastname; age is: V_Age.

This is nice, but sometimes PowerScript can become confused about of what you means, and in some cases it can't admit some character (like comma or parenthesis in a FileName)

If this happen, try to set a variable with the string, and then put the variable in you expression.

PowerScript isn't designed to support complex expression in a single line, if you experienced some problems, try to break an expression in two or more lines.

Frequently errors:

Not balanced parenthesis:

C_SetVar (V_St, P_GetDateDay (V_MyDate)

in the above line a right parenthesis fault

Try to access a variable without the V_ prefix:

C_Copy St

the above line will copy the word "St", not the variable V_St

A comma or a parenthesis in an expression.

License:

Please see the DataDuck.HLP at the Order Information section (from DataDuck press F1).


 Plugin names and location

A plugin is usually a file with .PLU extension.

If you put a file .PLU in the ...\DDuck\Plugin\ folder, or subfolder, it will appear in the Plugin Menu; if you put a file .PLU in another folder it can appear in a Plugin Button (a buttons set with the C_AddButton command).

If you add a file .PLU in the ...\DDuck\Plugin\ folder, or in a Button's related folder, you should close and restart DataDuck, to load the new file to the menu.

If you modify an existing plugin, you don't need to restart DataDuck.

If you make a plugin with a different extension, you can still execute it, using the C_CallScript command from another plugin, but the plugin will not appear in the Plugin Menu.

If a plugin is a plugin module, can be a good idea to name it with an extension different from .PLU, because may be you want it NOT appear in Plugin Menu.

To appear in Plugin Menu or in a Button menu a plugin file must start with the following two lines:

H_MenuTitle Title

H_MenuHelp Message bar description

where "Title" is the string that will appear in the menu, and "Message bar description" is a short description that will appear in the message bar at the bottom of DataDuck window.

There are some predefined plugin extensions:

.PLU default extension, the plugin can appear in Plugin Menu

.SUP Automatic Startup Plugin, this file must have the same name of a .PHN DataDuck file, and must be in the same folder of related .PHN file. This plugin will be executed any time the related .PHN file is open. The plugin of type .SUP support usual plugin commands and special field definitions commands, like T_SortName (see Field names and predefined variables names). I.E. if you have a file named Work.PHN and you create a plugin file named Work.SUP, this will be executed any time you will open the file Work.PHN

Default.SUP this is the name of Local User Automatic Plugin, if you create a plugin with this name, and put it in a folder of a Local User, this plugin will be executed any time a .PHN file will be opened.


 Plugin Headers

To appear in Plugin Menu or in a Button menu a plugin file must start with the following two lines:

H_MenuTitle Title

H_MenuHelp Message bar description

where "Title" is the string that will appear in the menu, and "Message bar description" is a short description that will appear in the message bar at the bottom of DataDuck window.

These header can also follow the above two lines:

H_Autor the author name

H_License type of license: freeware, shareware, commercial

H_AboutBegin start about text description, this will be implemented in future release.

  H_AboutEnd end about text description.

H_SuggestedFolder the folder where the user should install the plugin.

H_AutoAddFName  The name of a plugin file, it will be executed when the user click the Add Button. Example: V_ThisDir\AddDay.PLA, this command should appear in an Auto Startup Plugin (.SUP file)


Fields and internal variables
 Field names and predefined variables names

To get or put data from and in a field, or to set the sort criteria, you can use the field parameters, there are words with syntax:

F_

like F_Name or F_Lastname

Field identifiers:

F_UnSort

F_Title

F_Name

F_Lastname

F_Address

F_Memo

F_Company

F_Zip

F_Birth

F_AllRList

F_RList

F_RListLabel

F_UnqueID

F_NullField

To insert a breaking space or separator, you can use one of following words:

S_NL

S_CR

S_LF

S_SP

To get one of the predefined DataDuck Internal variables you can use the following names:

V_FileName

V_AppDir

V_ThisDir

V_CurUser

V_CurUserDir

V_GetCount

V_GetSelIndex

V_GetSelRListIndex

V_GetRListCount

V_LastUniqueID

To send command to DataDuck windows you can use following windows identifiers:

W_Left

W_Right

To set personalized label and description for any field (in an Automatic Startup plugin .SUP) you can use the following Title Strings:

T_SortLocked

T_SortTitle

T_SortName

T_SortLastname

T_SortAddress

T_SortMemo

T_SortUniqueID

T_Title

T_Name

T_Lastname

T_Address

T_Memo

T_Company

T_Zip

T_Birth

T_ButtAdd

T_ButtPhone

T_RListList

T_MainList

The personalized label have the form:

T_Name String for message bar\nString for tooltip

please note the \n separator.


 User variables name

PowerScript support various type of variables, the following are the ammitted type:

String: a string

Integer: an integer

Real: a floating number

File: a file

Date: a date

Bool: a boolean

All variables must be declared before the use, i.e.

C_InitVar (String, St) 	= Hello world

to use the above variable, you must put the prefix V_ at the beginning of it, i.e.

C_Copy V_St

some fuctions work with or without the V_ prefix, i.e.

C_Add (St, big world)

C_Add (V_St, big world)

are the same, however the V_ syntax make the code more readable.

If you want use a variable like second parameter, you must use the V_ syntax i.e.

C_Add (St, V_St2)

You can combine various variables and parameters in a line:

C_SetVar (V_St,Name is: F_Name, Lastname is: F_Lastname; age is: V_Age)


Exec
 C_Exec

Syntax

C_Exec command

Parameters

command: program name, or document name

Description

Exec a program, or open a document

Example

C_Exec c:\programs\myprog.exe

C_Exec notepad

C_Exec notepad c:\txt\mytext.txt

C_Exec c:\txt\mytext.txt


Copy
 C_Copy

Syntax

C_Copy text

Parameters

text: pure text, parameter, variable

Description

Copy data into Clipboard

Example

C_Copy Hello world

C_Copy Name is: F_Name, lastname is: F_Lastname


Wait
 C_Wait

Syntax

C_Wait (ms)

Parameters

ms: time to wait, in milliseconds

Description

Suspend plugin execution for ms milliseconds

Example

C_Wait (2000)


ForEach
 C_ForEach

Syntax

C_ForEach (nFout [,searchtext [,1] ] )  output string

Parameters

nFout: name of file for output

searchtext: optional text for filter

1: search in all files (for registered users only)

output string:  a formatted string for output

Description

Create an output text file, with data for all items.

If an optional searchtext parameter is furnished, it will be used to filter the search.

No comma are ammitted in nFout, nor in searchtext

Example

C_ForEach (c:\test.txt) First name is: F_Name, lastname is: F_Lastname S_LF

C_ForEach (c:\test.txt,Smith) F_Name F_Lastname, phone: F_Rlist(0) S_LF


Search
 C_Search

Syntax

C_Search (text)

Parameters

text: searched text

Description

Search the first recurrence of text

Example

C_Search (John)


Search All
 C_SearchAll

Syntax

C_SearchAll (text)

Parameters

text: searched text

Description

Search the first recurrence of text in the next file.

The next file must be checked in Multi Search dialog, under File Button Menu -> Organize -> Multi Search Options

Example

C_SearchAll (John)


SetSelIndex
 C_SetSelIndex

Syntax

C_SetSelIndex (num)

Parameters

num: the index of left list, 0 is the first element

Description

Select the record num in main list

Example

C_SetSelIndex (3)


SetSelPrev
 C_SetSelPrev

Syntax

C_SetSelPrev

Parameters

-

Description

Select the previous record, if selected record is 0, do nothing

Example

C_SetSelPrev


SetSelNext
 C_SetSelNext

Syntax

C_SetSelNext

Parameters

-

Description

Select the next record, if selected record is the last record, do nothing

Example

C_SetSelNext


SaveFile
 C_SaveFile

Syntax

C_SaveFile

Parameters

-

Description

Save current opened file

Example

C_SaveFile


OpenFile
 C_OpenFile

Syntax

C_OpenFile (Fname)

Parameters

Fname: the name of .PHN file to open

Description

Open a .PHN file, .PHN file is a file in DataDuck format

Example

C_OpenFile (V_AppDir\Documents\Work.PHN)


 C_SetField

Syntax

C_SetField (field, value)

Parameters

field: a field name (i.e. F_Address), or a Right List field (F_Rlist(0) ) reference

value: value for the field

Description

Set the field field to value

Example

C_SetField ( F_Name,John)

C_SetField ( F_Rlist(0),232.55.78)

Note

If you want no extra space in field you must pay attention to write:

C_SetField ( F_Name,John) instead of

C_SetField ( F_Name, John )


CopyDosFile
 C_CopyDosFile

Syntax

C_CopyDosFile (nFin, nFout)

Parameters

nFin: name of file to copy

nFout: name of new file

Description

Copy the file nFin with new name nFout

Example

C_CopyDosFile (C:\Autoexec.bat, C:\Autoexec.old)


GetAppWindow
 C_GetAppWindow

Syntax

C_GetAppWindow

Parameters

--

Description

Put the handle of DataDuck window into Clipboard, this is useful for synchronization functions, since an external plugin module can send messages directly to DataDuck

Example

C_GetAppWindow


SetWindowCaller
 C_SetWindowCaller

Syntax

C_SetWindowCaller

Parameters

--

Description

Get a long from Clipboard, representing the handle of window caller program

This is useful for synchronization functions, DataDuck can send messages directly to an external plugin module, with C_PostMessage command

Example

C_SetWindowCaller


WaitMessage
 C_WaitMessage

Syntax

C_WaitMessage (mex)

Parameters

mex: message to wait for

Description

DataDuck suspend plugin execution, until the message mex is received, this give an external module a way to perform synchronized operations with DataDuck.

Example

C_WaitMessage (501)

Note

If Esc is pressed, or no message is received, after about a minute, DataDuck resume the plugin execution


PostMessage
 C_PostMessage

Syntax

C_PostMessage (mex)

Parameters

mex: a long representing the message to post

Description

Post the message mex to the window previously set with the C_SetWindowCaller command, this is useful for synchronized operations

Example

C_PostMessage (501)


WaitFile
 C_WaitFile

Syntax

C_WaitFile (FName)

Parameters

FName: name of file to wait for

Description

This command is similar C_WaitMessage, it wait for the existence of file FName, this is not good for Windows applications, but it's useful for DOS applications. DOS applications can perfom synchronized operations with DataDuck, using the existence of a file like a semaphore

Example

C_WaitFile (C:\$$DDTest.$$$)

Note

After about a minute, if no file is found, DataDuck resume the plugin execution.


PostFile
 C_PostFile

Syntax

C_PostFIle (FName)

Parameters

FName: the name of file to create

Description

This command is similar C_PostMessage, it create a void file named FName, this is not good for Windows applications, but it's useful for DOS applications. DOS applications can perfom synchronized operations with DataDuck, using the existence of a file like a semaphore

Example

C_PostFile (C:\$$DDTest.$$$)


Halt
 C_Halt

Syntax

C_Halt

Parameters

--

Description

Stop the plugin execution

Example

...

C_If (Is_Minor (V_Count,2))

  C_Halt

...


SetFieldAttr
 C_SetFieldAttr

Syntax

C_SetFieldAttr (num, setbit, label)

Parameters

num: index or Right List field, 0 is the first item

setbit: the field attribute to set, more attributes can be nested with the | separator

setbit can have one of following value: As_Normal, As_Locked, As_HalfLocked, As_ReadOnly, As_NotSelectable

label: the label will be shown in the right list, for the field num

Description

Set the local attribute for an item of right list, the local attribute have the priority on the global attribute

Example

C_SetFieldAttr (0, As_Locked,Zip Code: )

See Also

Attributes


Attributes for Fields and Records
 Attributes for Fields and Record

Description

These attributes are parameter for the C_SetFieldAttr, C_SetGlbFieldAttr, C_SetGlbFieldDef, C_SetRecAttr functions

Some of these field attributes (i.e. As_HalfLocked) have sense only for right list items, other can be used for Right List and other fields too (i.e. As_ReadOnly).

Local field attributes (attributes valid only for one record) are ammitted only for Right List items, ie:

  C_SetFieldAttr (0,As_ReadOnly,Zip Code:)

Other fields have only global attributes:

  C_SetGlbFieldAttr (F_Name, As_ReadOnly)

the global attribute for Right List are specified with the function:

  C_SetGlbFieldDef (0, As_ReadOnly ,Zip Code:)

As_Normal: clear all field attributes

As_Locked: if it's a Right List field, a locked field can't be moved up or down with Ctrl+Uparrow. If it's another field, it consist of two part, a "Label", a colon ":", a text; i.e.  Part no.: 45243. You are responsible to set a text for locked field (if itsn't a Right List field) with a text containing the colon, else the user can experience unexpected result.

  !As_Locked: clear the As_Locked flag

As_HalfLocked: only the label of an halflocked field can't be moved, the field can be moved up or down

  !As_HalfLocked: remove the As_HalfLocked flag

As_ReadOnly: the field can't be modified, color of text will be gray

  !As_ReadOnly: clear the previous flag

As_NotSelectable: the field can't be selected, if the use click on it, the previous or next field will be selected, this is useful to make separator in Right List

  !As_NotSelectable: clear the previous flag

As_SkipGlobal: this is a record attribute, used with C_SetRecAttr command, this is useful in case you have global attribute for two or more Right List items, and you need a record with less items in Right List; if you set the local attribute for the right items you need, they will be correct, but the exceding items will have the global setting, if you use the C_SetRecAttr (As_SkipGlobal), all Right Global Attributes will be ignored for the selected record

  !As_SkipGlobal: clear previous flag

As_LeftVisible: not yet implemented, in this release you must copy manually or with a plugin a Right List field to left, if you need Left Visibility


NullCommand
 C_NullCommand

Syntax

C_NullCommand ...

Parameters

--

Description

Only the line with a command (a word beginning with C_) are loaded in the PowerScrip compiler, the C_NullCommand force the execution of a non command line, this can be used in some debug case, with the C_Trace enabled

Example

C_NullCommand F_Name


CallScript
 C_CallScript

Syntax

C_CallScript (FName)

Parameters

FName: the name of a plugin file

Description

Load and execute another plugin, the variables are passed to other plugin, when the other plugin terminate the control return to the caller

Example

C_CallScript (V_ThisDir\SubProc.001)


SetFocus
 C_SetFocus

Syntax

C_SetFocus (FieldName)

Parameters

FieldName: the name of field that will receive the user input focus

Description

Set the focus to the FieldName field

Example

C_SetFocus (F_Memo)


If
 C_If

Syntax

C_If (condition)

Parameters

condition: a Logical Condition

Description

Execute the following line, or the following block of lines, if the Logical Condition is TRUE

Example

C_If (Is_Minor (V_Count, 3) )

  C_Halt

C_Else

  C_MessageBox (Information,Value of count is: V_Count)

C_If (Is_Minor (V_Count, 3) )

  C_Begin

  ...

  C_End

...

See Also

Logical Conditions


 Logical Conditions

Description

A logical condition is used with the C_If and C_While command

Is_Equal (x,y) : TRUE if x and y are equal

!Is_Equal (x,y) TRUE if x and y are not equal

Is_Minor (x,y) TRUE if x < y

Is_Major (x,y) TRUE if x > y

Is_EqualOrMinor (x,y) TRUE if x <= y

Is_EqualOrMajor (x,y) TRUE if x >= y

Is_Feof (V_File) TRUE if the file related to variable (of type File) V_File is at end of file

!Is_Feof (V_File) TRUE if the file related to variable (of type File) V_File is NOT at end of file

P_True: ever TRUE

P_False: ever FALSE

P_Break TRUE if the user have pressed the ESC key

!P_Break TRUE if the user haven't pressed the ESC key


Else
 C_Else

Syntax

C_If (logical condition)

  ...

C_Else

  ...

Parameters

--

Description

Execute the following line, or the following block of lines, if the Logical Condition for the previous C_If was FALSE

Example

C_If (Is_Minor (V_Count, 3) )

  C_Halt

C_Else

  C_MessageBox (Information,Value of count is: V_Count)

See Also

Logical Conditions


Begin
 C_Begin

Syntax

C_Begin

C_End

Parameters

--

Description

C_Begin and C_End start and terminate the program code, or start and terminate a block of program for conditional execution

Example

...

C_Begin

...

C_If (Is_Minor(V_Count,3) )

  C_Begin

  ...

  C_End

...

C_End


End
 C_End

See C_Begin


Trace
 C_Trace

Syntax

C_Trace (LineNum)

Parameters

LineNum: line from where start the trace

Description

Trace the plugine execution, starting from line LineNum, this is used for debug

Example

C_Trace (10)


StoreUniqueFileName
 C_StoreUniqueFileName

Syntax

C_StoreUniqueFileName (Path, Prefix, Ext)

Parameters

Path: the folder where search for unique file name

Prefix: the prefix to assign to unique file name

Ext: the extension to assign to unique file name

Description

This function search in the Path folder for all file beginning with Prefix, and with Ext extension, then add a unique number to the Prefix, and finally store the vaule in P_UniqueFileName internal variable. P_UniqueFileName variable can be used lather for creation of a unique file, and the unique file can be added like an External Link in the Right List

In 16 bit version, you are responsible to furnished a short word for Prefix, (max file name lenght in 16 bit version is 8 chars), no such limit exist in 32 bit version

Example

// Store a value like: C:\Dduck\Agenda\Cards\Card5.DOC

C_StoreUniqueFileName (V_ThisDir\..\Cards, Card, DOC)

// Add a Link in Right List

C_SetField (F_RList(V_GetRListCount),Exec: P_UniqueFileName)

// Copy an existing file with P_UniqueFileName name

C_CopyDosFile (V_ThisDir\..\Cards\Card.DOT,P_UniqueFileName)


ImportFile
 C_ImportFile

Syntax

C_ImportFile(FName, Separator) string...

Parameters

FName: the name of file to open for reading

Separator: the separator used in the file

string: a string with the DataDuck fields name, to use for import

Description

This function open the file FName, created with another program, and create a new record for any line of the file FName, and assign at the DataDuck fields the values following the string specification

Example

// This example assume you have a file named C:\MyFile.txt, containing various lines, any line have the form:

//  John§Smith§John is a friend of Judy

//  Mary§Red§Mary work in Boston

C_ImportFile (C:\MyFile.txt,§) F_Name F_Lastname F_Memo


While
 C_While

Syntax

C_While (contidion)

Parameters

contidion: a Logical Condition

Description

Execute the following line, or the following block of lines, until the logical condition condition is TRUE

Example

C_While (Is_Minor (V_Count,10) )

  C_Begin

  ...

  C_End

See Also

Logical Conditions


SetVar
 C_SetVar

Syntax

C_SetVar (VarName, Value)

Parameters

VarName: the name of variable

Value: the vaule to assign to VarName

Description

Assign a value to a variable, variable must be previously declared with the C_InitVar command

If you assign a value to a string variable, you should pay attention to the spaces after comma and before parenthesis

Example

C_SetVar ( StName,John)

C_SetVar ( x, 125 )


GetVar
 P_GetVar

Syntax

P_GetVar (VarName)

Parameters

VarName: the name of variable

Description

This funcion return the value of variable VarName, this funcion can be used in some rare case, usually is more easy use the V_ syntax, the following two line will give the same result:

P_GetVar (St)

V_St

Example

// These two examples will put the value of var V_St into Clipboard

C_InitVar (String, St)	= Hello world

C_Copy C_GetVar (St)

C_InitVar (String, St)	= Hello world

C_Copy V_St


Add
 C_Add

Syntax

C_Add (VarName, Value)

Parameters

VarName: variable name

Value: value to add to variable VarName

Description

This function add the value Value to variable VarName; the variable VarName must be previously declared with the C_InitVar command, if you add a string to another string, you should pay attention to the spaces.

Example

// This example copy the string "Jonh Smith" in to Clipboard

C_InitVar (String, St)	= John

C_Add (St, Smith)

C_Copy V_St


Sub
 C_Sub

Syntax

C_Sub (VarName, Value)

Parameters

VarName: variable name

Value: value to subtract from variable VarName

Description

Subtract the value Value from var VarName

Example

C_InitVar (Integer, x)	= 10

C_Sub (X, 3)


Mul
 C_Mul

Syntax

C_Mul (VarName, Value)

Parameters

VarName: variable name

Value: value

Description

Multiply VarName for Value

Example

C_InitVar (Integer, X)	= 10

C_Mul (X, 3)


Div
 C_Div

Syntax

C_Div (VarName, Value)

Parameters

VarName: variable name

Value: value

Description

Divide the variable VarName for value Value

Example

C_InitVar (Integer, X)	= 30

C_Div (X, 3)


Beep
 C_Beep

Syntax

C_Beep

Parameters

--

Description

Play a short beep

Example

C_Beep


DisableEsc
 C_DisableEsc

Syntax

C_DisableEsc

Parameters

--

Description

Disable the UserBreak control, when the Esc control is enabled the user can stop the plugin pressing the ESC key, when the Esc control is disabled the plugin can't be terminated pressing ESC.

Usually is better don't use this command, because if plugin contain some error, like an infinite loop, the user must reboot the machine

Example

C_DisableEsc


EnableEsc
 C_EnableEsc

Syntax

C_EnableEsc

Parameters

--

Description

See C_DisableEsc

Example

C_EnableEsc


Label
 C_Label

Syntax

C_Label Label

Parameters

Label

Description

Declare a label, the label can be used with C_Goto command

Example

C_If (Is_Minor (V_Count, 3) )

  C_Goto (CASE1)

...

C_Label CASE1

...


Goto
 C_Goto

Syntax

C_Goto (Label)

Parameters

Label: a previously declared label

Description

Move the execution point to Label line

Example

See: C_Label


Reindex
 C_Reindex

Syntax

C_Reindex

Parameters

--

Description

Reindex the currently opened file. This means all uniques ID assigned to any item, will be cleared, and the first item will receive the ID 1, the second the ID 2, and so on.

When the user enter a new item, then delete it, the ID count is incremented, so the major ID can become very big, if the file currenctly opened is NOT related to other file, that use the unique ID, and have NOT Internal Link (ILink), you can reindex it.

Pay attention, if the file is related to another file that use ILink, or if the user have put some Internal Link, the reference will become invalid

Example

C_MessageBox (Warning, Are you sure you want reindex this file?)

C_Reindex


SetSelUniqueID
 C_SetSelUniqueID

Syntax

C_SetSelUniqueID (num)

Parameters

num: the Unique ID number

Description

Force the selection of the item with the Unique ID num, if it exist

Example

C_SetSelUniqueID (27)


TraceCall
 C_TraceCall

Syntax

C_TraceCall (FName)

Parameters

FName: a file name

Description

This command will append a report for any call to the text file FName, this file can be use in a company to extract data about calls, another data base program can examine this file.

You can generate a file to see the format of the file itself

If you want the Trace be active for any work session with a certain file, you should put the command in an AutoStartup plugin for the file; if you want the Trace be active for any file, you should put the command in an AutoUserStartup plugin

Example

C_TraceCall (C:\CallRep\Call.txt)


TraceLink
 C_TraceLink

Syntax

C_ TraceLink(FName)

Parameters

FName: a file name

Description

This command will append a report for any called Link to the text file FName, this file can be use in a company to extract data about Link used from an user, another data base program can examine this file.

A link is an item in a Rigth List in the form:

Exec: FileName

or

ILink: ...

You can generate a file to see the format of the file itself

If you want the Trace be active for any work session with a certain file, you should put the command in an AutoStartup plugin for the file; if you want the Trace be active for any file, you should put the command in an AutoUserStartup plugin

Example

C_ TraceLink(C:\LinkRep\Link.txt)


IncDate
 C_IncDate

Syntax

C_IncDate (VarDate)

Parameters

VarDate: a variable of type Date

Description

Increment the date VarDate to the next day. If the date is 31 December 1980, it will become 1 Genuary 1981

Example

C_IncDate (V_MyDate)


DecDate
 C_DecDate

Syntax

C_DecDate (VarDate)

Parameters

VarDate: a variable of type Date

Description

Decrement the date VarDate to the previous day. If the date is 1 Genuary 1981 it will become 31 December 1980,

Example

C_DecDate (V_MyDate)


HideWindow
 C_HideWindow

Syntax

C_HideWindow (Window)

Parameters

Window: the window to hide, this parameter can be W_Left or W_Right

Description

This function hide the window Window, it is useful for plugin that perform long add record operations, the redraw of window require a lot of time, so a plugin can disable the redraw, add various items, the enable the redraw.

Example

C_HideWindow (W_Left)

C_HideWindow (W_Right)

// add some items

...

// enable the redraw

C_ShowWindow (W_Left)

C_ ShowWindow(W_Right)


Comment
 Comments

Description

//

The // can be used to make a line a comment. It's like REM for Basic

Example

C_SetVar (X, 2)

// This line is a comment

C_Add (x, 3)


ShowWindow
 C_ShowWindow

Syntax

C_ShowWindow (Window)

Parameters

Window: window to show, this parameter can be W_Left or W_Right

Description

See: C_HideWindow


SetRedraw
 C_SetRedraw

Syntax

C_SetRedraw (Window, ShowFlag) P TRUE

Parameters

Window: window to show, this parameter can be W_Left or W_Right

ShowFlag: boolean value, can be P_False or P_True

Description

See: C_HideWindow


MessageBox
 C_MessageBox

Syntax

C_MessageBox (Title, Text)

Parameters

Title: the title of the message box

Text: the text of the message

Description

This function open the usual Windows message box dialogs, with two button (Yes, No), if the user press No, the plugin will be terminated

Example

C_MessageBox (Info, Long operationS_NL Do you want to continue?)


FlyMessageBox
 C_FlyMessageBox

Syntax

C_FlyMessageBox (Title, Text)

Parameters

Title: the title of dialog

Text: text for the dialog

Description

This open a NON modal dialog, useful to inform the user of some things.

Example

C_FlyMessageBox (Info, Please wait...S_NL Press Esc to stop)


SetGlbFieldAttr
 C_SetGlbFieldAttr

Syntax

C_SetGlbFieldAttr (FieldName, SetBit)

Parameters

FieldName: the field name, can be F_Title, F_Name.. it can't be a Right List field

SetBit: attribute to set

Description

Set a field attribute, the attribute will be valid for all records

Example

C_SetGlbFieldAttr (F_Name, As_ReadOnly)

See Also

Attributes


SetGlbFieldDef
 C_ SetGlbFieldDef

Syntax

C_SetGlbFieldDef (Num, Attr, Label)

Parameters

Num: Right List item, first item is 0

Attr: attribute to set or clear

Label: a label

Description

Set a global definition for all records, the definition is related to one item of Right List, the label Label will appear in the Right List, before the list text

Example

C_SetGlbFieldDef (0, As_Locked ,Zip Code:)


SetSortField
 C_SetSortField

Syntax

C_SetSortField (FieldName)

Parameters

FieldName: name of field to use for sort, can be like: F_Name, or F_Rlist (num).

You can use the usual field name, like F_Title, or a special pseudo field like F_Unsort, or F_UniqueID

Description

Resort the list using the field FieldName like sort criteria

Example

C_SetSortField ( F_Name )

C_SetSortField ( F_Rlist(0) )

C_SetSortField (F_UniqueID)

C_SetSortField (F_Unsort)

See also

Field names and predefined variables names


InitVar
 C_InitVar

Syntax

C_InitVar (VarType, VarName)

C_InitVar (VarType, VarName) = Value

Parameters

VarType: variable type, like String, Integer..

VarName: name of variable

Value: optional value for initialization

Description

Any variable must be declared with C_InitVar before use.

The C_InitVar function can be optionally set an initial value for the variable, this line:

C_InitVar (String, St)	= Hello world

is like the following two lines

C_InitVar (String, St)

C_SetVar (St,Hello world)

Example

C_InitVar (String, St)	= Hello world

See also

User variables name


ImportFixChar
 C_ImportFixChar

Syntax

C_ImportFixChar (StartLine, FileName)

C_Spaces (num, num1, num2...)

C_Imp (Field, Label)

Parameters

StartLine: line to start from

FileName: name of file to open

num, num1, num2...: number of spaces in import file

Field: field name to assign numx

Label: optional label

Description

This is really a powerful command, and you must pay attention to right use of them, because it don't perform any control about correct syntax, so you must write the plugin exactly, or DataDuck will crash.

This function import a fixed space data base text file into DataDuck, and translate it into DataDuck format, clearing extra spaces.

You can assign value to any DataDuck field, or combine more external value in a single field.

This command have other commands strictly related to them

C_ImportFixChar command must be followed from a C_Spaces command, and from a block of C_Imp command

You should insert a C_Imp for any num you have put in C_Spaces, if you don't need a field, you can use the F_NullField parameter in C_Imp

Example

C_FlyMessageBox (Info, Please wait)

C_ImportFixChar (2, C:\MyFile.txt)

C_Spaces (32,1,7,22,2,22)

  C_Begin

  C_Imp (F_LastName,)

  C_Imp (F_RList(0),Sex: )

  C_Imp (F_ RList(1),Birth date: )

  C_Imp (F_ RList(2),City: )

  C_Imp (F_NullField,)

  C_Imp (F_Address,)

C_End

C_FlyMessageBox ()


Spaces
 C_Spaces

Description

See: C_ImportFixChar


Imp
 C_Imp

Description

See: C_ImportFixChar


RedrawWindow
 C_RedrawWindow

Syntax

C_RedrawWindow

Parameters

--

Description

Redraw the DataDuck window. Some times a message box followed from add operations, can leava DataDuck window damaged, this command redraw and clean DataDuck window

Example

C_RedrawWindow


SetRecAttr
 C_SetRecAttr

Syntax

C_SetRecAttr (Attr)

Parameters

Attr: attribute to set

Description

Set the attribute Attr for the record currently selected

Example

C_SetRecAttr ( As_SkipGlobal )

See Also

Attributes


MessageBar
 C_MessageBar

Syntax

C_MessageBar (Text)

Parameters

Text: text to put in message bar

Description

Set the text of message bar to Text, this inform the user about what your plugin is making

Example

C_MessageBar (Working..., press ESC to stop)


SetGlbFieldColor
 C_SetGlbFieldColor

Syntax

C_SetGlbFieldColor (Num, NumColor)

Parameters

Num: Right List item, 0 is the first item

NumColor: number of colour, 0 is black, -1 clear the color attribute

Description

Set the color for the Right List item Num, for all records

Example

C_SetGlbFieldColor (0, 5)


SetRecColor
 C_SetRecColor

Syntax

C_SetRecColor (NumColor)

Parameters

NumColor: color to set

Description

Set the color for the selected record, color will be used in the Left List

Example

C_SetRecColor (5)


SetFieldColor
 C_SetFieldColor

Syntax

C_SetFieldColor (Num, NumColor)

Parameters

Num: Right List item

NumColor: color number, 0 is black, -1 will clear the color attribute

Description

Set the color NumColor for the Right List item Num , the color is only for selected record

Example

C_SetFieldColor (0, 5)


AddButton
 C_AddButton

Syntax

C_AddButton (PlugFile, Label, BmpFile, Folder)

Parameters

PlugFile: plugin file associated with the button

Label: string to identify the button, this string can be breacked from a \n character, the first part will be the label name, the second part will be the message bar text

BmpFile: optional bitmap file to use with the button, or an internal DataDuck bitmap, like BMP_FAX

Folder: an optional parameter, that make the button a Menu Button

Description

Add a button to DataDuck, the button will be placed after the clock, the button will have the label Label, and it will have the bitmap specified in BmpFile, if the Folder parameter is furnished, when the user click the button, a menu will appear, containing all plugins that are in folder Folder

Example

// a Button

C_AddButton (V_ThisDir\GoToday.plb, Move to today item\nToday, V_ThisDir\GoToday.bmp)

// a Menu Button

C_AddButton (--, Agenda menu\nAgenda, V_ThisDir\Agenda.bmp, V_ThisDir)


SetButtBmp
 C_SetButtBmp

Syntax

C_SetButtBmp (Button, FileName)

Parameters

Button: a DataDuck Button, this parameter can be:

BMP_FILE 	Menu Button File

BMP_BACK	Back button

BMP_NEXT	Forward button

BMP_SORT	Sort button

BMP_ADD	\Add button

BMP_PLUGIN	Plugin button

BMP_SAVE	Save button

BMP_EMAIL	EMail bitmap

BMP_URL	Bitmap for Web link

BMP_FAX	Fax bitmap

BMP_DOCUMENT	Generic external link bitmap

BMP_ILINK	Internal link bitmap

FileName: a file name

Description

This function change the default bitmap for the button Button, with the bitmap of .BMP file FileName.

Usually this function is used in a Automatic Startup Plugin, like a .SUP plugin related to a file, or in the Local User Automatic plugin Default.SUP.

For best result a button bitmap should be a 16 or 256 color bitmap, 32x32 pixels (width and height).

In this release Magenta color will be considered transparent.

Example

C_SetButtBmp

C_SetButtBmp (BMP_FILE, V_AppDir\MyFile.BMP)


SetBarBmp
 C_SetBarBmp

Syntax

C_SetBarBmp (FileName)

Parameters

FileName: a file name

Description

This function change the default bar bitmap (the bitmap of the bar with buttons), with the bitmap of .BMP file FileName.

Usually this function is used in a Automatic Startup Plugin, like a .SUP plugin related to a file, or in the Local User Automatic plugin Default.SUP.

A bar bitmap should have a bottom line, 7 pixels heigh.

Usually a bar bitmap is a 256 color bitmap, 100 pixels height, 400 pixels width, with jointable left and right color, and a 7 pixels height bottom line, but all this matter is leaved at your choice.

Example

// form 1 will clear Bar Bitmap (default bitmap)

C_SetBarBmp ()

// form 2: select a bitmap

C_SetBarBmp(V_AppDir\Bmp\MyFile.BMP)


OpenDosFile
 C_OpenDosFile

Syntax

C_OpenDosFile (Mode, VarFile, FileName)

Parameters

Mode: how open the file, can be:

rt	Open for reading only.

wt	Create for writing. If a file by that name already exists, it will be overwritten.

at	Append; open for writing at end-of-file or create for writing if the file does not exist.

rt+	Open an existing file for update (reading and writing).

wt+	Create a new file for update (reading and writing). If a file by that name already exists, it will be overwritten.

at+	Open for append; open (or create if the file does not exist) for update at the end of the file.

VarFile: a variable of type File, previously declared

FileName: the name of file to open

Description

This function open a file, for writing or reading

Example

C_InitVar (File, Fout)

C_OpenDosFile (wt, Fout, C:\Delme.txt)

C_WriteDosFile ( Fout ,Hello world)

C_CloseDosFile (Fout)


WriteDosFile
 C_WriteDosFile

Syntax

C_WriteDosFile (VarFile, Text)

Parameters

VarFile: a variable of type File

Text: the text to write in to the file

Description

Write in a file opened for write mode (w or a mode)

Example

C_InitVar (File, Fout)

C_OpenDosFile (wt, Fout, C:\Delme.txt)

C_WriteDosFile ( Fout ,Hello world)

C_CloseDosFile (Fout)


ReadDosFile
 C_ReadDosFile

Syntax

C_ReadDosFile (VarFile, stLine)

Parameters

VarFile: a variable of type File

stLine: a variable of type String that will receive a line of the file

Description

Read a string from the file VarFile, in the variable stLine

Example

C_InitVar (String, St)

C_InitVar (File, Fin)

C_OpenDosFile (rt, Fin, C:\Delme.txt)

C_While (!Is_Feof(V_Fin))

  C_Begin

  C_ReadDosFile (V_Fin, St)

  C_MessageBox (A line,This line is:S_NLV_St)

  C_End

C_CloseDosFile (Fin)


Closedosfile
 C_CloseDosFile

Syntax

C_CloseDosFile (VarFile)

Parameters

VarFile: a variable of type File

Description

Close a previously opened file

Example

C_InitVar (File, Fout)

C_OpenDosFile (wt, Fout, C:\Delme.txt)

C_WriteDosFile ( Fout ,Hello world)

C_CloseDosFile (Fout)


PrintDosFile
 C_PrintDosFile

Syntax

C_PrintDosFile (FileName)

Parameters

FileName: a file name

Description

Print a text file, the user will be prompted about print mode, and about a MSWord template to use for the printing

Example

C_PrintDosFile (C:\Delme.txt)


AskFileOpen
 P_AskFileOpen

Syntax

P_AskFileOpen

P_AskFileOpen (FName)

Parameters

FName: optional default file name or extension

Description

Create a File Open dialog box, using the default file name or extension FName, and return a string with a file name

Example

C_InitVar (String, St)

C_SetVar (St,P_AskFileOpen(*.TXT))

C_MessageBox (Info, You have asked to open V_St)


AskFileSave
 P_AskFileSave

Syntax

P_AskFileSave

FName

Parameters

FName: optional default file name or extension

Description

Create a File Save dialog box, using the default file name or extension FName, and return a string with a file name

Example

C_InitVar (String, St)

C_SetVar (St,P_AskFileSave(*.TXT))

C_MessageBox (Info, You have asked to save V_St)


AskString
 P_AskString

Syntax

P_AskString (Title, DefValue)

Parameters

Title: dialog box title

DefValue: default value for the string

Description

Create an input dialog, and ask an input to the user.

The input is a string, you can use it for any variable type

Example

C_InitVar (Integer, Age)	= 22

C_SetVar (Age, P_AskString (Enter age,V_Age) )

C_MessageBox (Info, Age is: V_Age)


MessageBox
 P_MessageBox

Syntax

P_MessageBox (Title, Text)

Parameters

Title: dialog title

Text: text for the dialog

Description

Parametric version of C_MessageBox, usually is better to use the C_MessageBox version

Example

C_NullCommand P_messagebox(Info, Hello world)

See also

C_MessageBox


LastItem
 P_LastItem

Syntax

P_LastItem

!P_LastItem

Note

The first is the normal boolean condition, TRUE if the parameter is TRUE

The second is the FALSE condition, TRUE if the parameter is NOT TRUE

Description

A parameter used in logical condition, to test if the last record is selected

Example

C_While (!P_LastItem)

  C_SetSelNext


Break
 P_Break

Syntax

P_Break

!P_Break

Note

The first is the normal boolean condition, TRUE if the parameter is TRUE

The second is the FALSE condition, TRUE if the parameter is NOT TRUE

Description

Return TRUE if the user have pressed the ESC key.

Internally used to test user break request.


FirstItem
 P_FirstItem

Syntax

P_FirstItem

!P_FirstItem

Note

The first is the normal boolean condition, TRUE if the parameter is TRUE

The second is the FALSE condition, TRUE if the parameter is NOT TRUE

Description

A parameter used in logical condition, to test if the first record is selected

Example

C_While (!P_ FirstItem)

  C_SetSelPrev


UniqueFileName
 P_UniqueFileName

Syntax

P_UniqueFileName

Description

This parameter return the unique file name, previously stored with the C_StoreUniqueFileName command

See also

C_StoreUniqueFileName


GetDateCurrent
 P_GetDateCurrent

Syntax

P_GetDateCurrent

Description

This parameter return the current system date

Example

C_MessageBox (Date,Current date is: P_GetDateCurrent)


GetDateCurrentYear
 P_GetDateCurrentYear

Syntax

P_GetDateCurrentYear

Description

This parameter return the current system date year

Example

C_MessageBox (Date,Current year is: P_GetDateCurrentYear)


GetDateSeparator
 P_GetDateSeparator

Syntax

P_GetDateSeparator

Description

This parameter return the system date separator (usually / or -)

Example

C_MessageBox (Date,Current date separator is: P_GetDateSeparator)


GetDateFormat
 P_GetDateFormat

Syntax

P_GetDateFormat

Description

This parameter return a string, representing the system date format (a string like: dd/MM/yy)

This string can be used to write specific date functions.

Example

C_MessageBox (Date,Current date format is: P_GetDateFormat)


GetDateDay
 P_GetDateDay

Syntax

P_GetDateDay (MyDate)

Parameters

MyDate: var of type Date

Description

This function extract the numeric value of day from date MyDate

Example

C_InitVar (Date, MyDate)	// will be 1/1/1980

C_MessageBox (Date,Date: V_MyDate S_NLDay of Date: P_GetDateDay(V_MyDate))


GetDateDayOfWeek
 P_GetDateDayOfWeek

Syntax

P_GetDateDayOfWeek (MyDate)

Parameters

MyDate: var of type Date

Description

This function extract the string value of day from date MyDate (Like "Monday")

Example

C_InitVar (Date, MyDate)	// will be 1/1/1980

C_MessageBox (Date,Date: V_MyDate S_NLDay of week of Date: P_GetDateDayOfWeek(V_MyDate))


GetDateDayName
 P_GetDateDayName

Syntax

P_GetDateDayName(Num)

Parameters

Num: number of day

Description

This function return a string containing the name of the Num day of the week, for 0 Sunday, for 1 Monday, and so on

Example

C_MessageBox (Date,The name of week day 0 is: P_GetDateDayName(0) )


GetDateDayOfWeekInt
 P_GetDateDayOfWeekInt

Syntax

P_GetDateDayOfWeekInt (MyDate)

Parameters

MyDate: var of type Date

Description

This function extract the numeric value of week day number from date MyDate.

Sunday is 0; Monday is 1, and so on.

Example

C_InitVar (Date, MyDate)	// will be 1/1/1980

C_MessageBox (Date,Date: V_MyDate S_NLWeek day number of Date: P_GetDateDayOfWeekInt(V_MyDate))


GetDateMonth
 P_GetDateMonth

Syntax

P_GetDateMonth (MyDate)

Parameters

MyDate: var of type Date

Description

This function extract the string value of month from date MyDate (Like "January")

Example

C_InitVar (Date, MyDate)	// will be 1/1/1980

C_MessageBox (Date,Date: V_MyDate S_NLName of month of Date: P_GetDateMonth(V_MyDate))


GetDateMonthInt
 P_GetDateMonthInt

Syntax

P_GetDateMonthInt (MyDate)

Parameters

MyDate: var of type Date

Description

This function extract the numeric value of month from date MyDate.

January is 1; February is 2, and so on.

Example

C_InitVar (Date, MyDate)	// will be 1/1/1980

C_MessageBox (Date,Date: V_MyDate S_NLMonth number of Date: P_GetDateMonthInt(V_MyDate))


GetDateYear
 P_GetDateYear

Syntax

P_GetDateYear (MyDate)

Parameters

MyDate: var of type Date

Description

This function extract the numeric value of year from date MyDate.

Example

C_InitVar (Date, MyDate)	// will be 1/1/1980

C_MessageBox (Date,Date: V_MyDate S_NLYear number of Date: P_GetDateYear(V_MyDate))


GetDateDayOfYear
 P_GetDateDayOfYear

Syntax

P_GetDateDayOfYear (MyDate)

Parameters

MyDate: var of type Date

Description

This function return the numeric value of day of year from date MyDate.

First day is 1, last day 365 or 366.

Example

C_InitVar (Date, MyDate)	// will be 1/1/1980

C_MessageBox (Date,Date: V_MyDate S_NLDay of year of Date: P_GetDateDayOfYear(V_MyDate))


IsDateBisestile
 P_IsDateBisestile

Syntax

P_IsDateBisestile (MyDate)

Parameters

MyDate: var of type Date

Description

This is a Boolean function, it return 1 or 0 (TRUE or FALSE) if the year of date MyDate is a bisestile year (leap year, when February have 29 days)

Example

C_InitVar (Date, MyDate)	= P_GetDateCurrent

// MyDate become current date

C_MessageBox (Date,Date: V_MyDate S_NLIs this a leap year? P_IsDateBisestile(V_MyDate))


GetMoonInfo
 P_GetMoonInfo

Syntax

P_GetMoonInfo (MyDate)

Parameters

MyDate: var of type Date

Description

This function return extended informations about Moon phase

Example

C_InitVar (Date, MyDate)	= P_GetDateCurrent

// MyDate become current date

C_MessageBox (Date,Date: V_MyDate S_NLMoon info: P_GetMoonInfo(V_MyDate))


StrPos
 P_StrPos

Syntax

P_StrPos (St, SubSt)

Parameters

St: a string

SubSt: searched string

Description

This function return the numeric position of string SubSt inside St.

First character is 0, is no SubSt is found, -1 is returned.

Please pay attention to not insert extra space in strings.

Example

C_MessageBox (Info,P_StrPos (Hello World,Wo) )


StrStr
 P_StrStr

Syntax

P_StrStr (St, SubSt)

Parameters

St: a string

SubSt: searched string

Description

Scans a string for the occurrence of a given substring.

strstr scans St for the first occurrence of the substring SubSt.

Return Value

P_StrStr returns a pointer to the element in St, where SubSt begins (points to SubSt in St). If SubSt does not occur in St, strstr returns null string.

Example

C_MessageBox (Info,P_StrStr(Hello World,Wo) )

// the above line will return World


StrChar
 P_StrChar

Syntax

P_StrChar (Num, St)

Parameters

Num: position of char

St: a string

Description

This function return the character Num of string St, first character is 0

Example

C_MessageBox (Info,P_StrChar (6,Hello World) )

// the above line will return W


StrTrunc
 P_StrTrunc

Syntax

P_StrTrunc (Num, St)

Parameters

Num: an integer

St: a string

Description

This function will return the string St, trucated at position Num

Example

C_MessageBox (Info,P_StrTrunc (5,Hello World) )

// the above line will return Hello


StrRev
 P_StrRev

Syntax

P_StrRev (St)

Parameters

St: a string

Description

This funcion return the reversed string St (first character will become the last character, and so on)

Example

C_MessageBox (Info,P_StrRev(Hello World) )

// the above line will return dlroW olleH


StrDel
 P_StrDel

Syntax

P_StrDel (St, NumChar, Pos)

Parameters

St: a string

NumChar: number of characters to delete

Num: where to delete

Description

This function will delete NumChar characters in string St, starting at position Pos, 0 is first position.

Please pay attention to not insert extra spaces in strings.

Example

C_MessageBox (Info,P_StrDel(Hello Big World,6 ,3) )

// the above line will return Hello World


StrInsert
 P_StrInsert

Syntax

P_StrInsert (St, SubSt, Num)

Parameters

St: a string

SubSt: a string

Num: where to insert

Description

This function will insert the substring SubSt inside string St, at position Num, 0 is first position.

Please pay attention to not insert extra spaces in strings.

Example

C_MessageBox (Info,P_StrInsert(Hello World,big ,6) )

// the above line will return Hello big World


StrLen
 P_StrLen

Syntax

P_StrLen (St)

Parameters

St: a string

Description

This function will return the length (number of characters) of string St

Example

C_MessageBox (Info,P_StrLen(Hello World) )

// the above line will return 11


GetFieldAttr
 P_GetFieldAttr

Syntax

P_GetFieldAttr (RIndex)

Parameters

RIndex: index of Right List item, first item is 0

Description

This function will return a long number representing the attribute of Right List item at position Rindex.

If no attribute is set for item RIndex, 0 will returned.

If item RIndex have Local Attribute, Local Attribute will returned, else if it have Global Attribute, Global Attribute will returned

Example

C_MessageBox (Info,P_GetFieldAttr(0) )

See also:

Attributes


FileName
 V_FileName

Syntax

V_FileName

Description

The complete name (path+name+extension) of currently opened DataDuck file

Example

C_MessageBox (Info,Opened file is: V_FileName )


AppDir
 V_AppDir

Syntax

V_AppDir

Description

The name of folder where is DataDuck.EXE

Example

C_MessageBox (Info,Application folder: V_AppDir)


ThisDir
 V_ThisDir

Syntax

V_ThisDir

Description

The folder where the currently in execution plugin come from

Example

C_MessageBox (Info,This plugin is stored in: V_ThisDir)


CurUser
 V_CurUser

Syntax

V_CurUser

Description

The name of currently selected Local User

Example

C_MessageBox (Info,Local User is: V_CurUser)


CurUserDir
 V_CurUserDir

Syntax

V_CurUserDir

Description

The default folder for current Local User

Example

C_MessageBox (Info,Current user folder: V_CurUserDir)


GetCount
 V_GetCount

Syntax

V_GetCount

Description

Nuber of records in opened file

Example

C_MessageBox (Info,Number of records: V_GetCount)


GetSelIndex
 V_GetSelIndex

Syntax

V_GetSelIndex

Description

Intex of selected record.

The first record is 0, if no record is selected, -1 will returned

Example

C_MessageBox (Info,Selected record is: V_GetSelIndex)


GetSelRListIndex
 V_GetSelRListIndex

Syntax

V_GetSelRListIndex

Description

The index of selected Right List item, first element is 0

Example

C_MessageBox (Info,Right List selected index is: V_GetSelRListIndex)


GetRListCount
 V_GetRListCount

Syntax

V_GetRListCount

Description

Number of items in Right List

Example

C_MessageBox (Info,Items in Right List is: V_GetRListCount)


LastUniqueID
 V_LastUniqueID

Syntax

V_LastUniqueID

Description

The value of the bigger record Unique ID in opened PHN file

Example

C_MessageBox (Info,Max Unique ID is: V_LastUniqueID)


NL
 S_NL

Syntax

S_NL

Description

Insert a New Line (\r\n) in a string

Example

C_MessageBox (Info,First lineS_NLSecond Line)


CR
 S_CR

Syntax

S_CR

Description

Insert a carriage return (\r) in a string

Example

C_MessageBox (Info,First lineS_CRSecond Line)


LF
 S_LF

Syntax

S_LF

Description

Insert a Line Feed (\n) in a string

Example

C_MessageBox (Info,First lineS_LFSecond Line)


SP
 S_SP

Syntax

S_SP

Description

Insert a space (char 32) in a string, sometime DataDuck clear blank spaces to the left and right of a string, with this parameter you can force DataDuck to keep blank spaces.

Example

C_MessageBox (Info,S_SPHelloS_SPWorld)


UnSort
 F_Unsort

Syntax

F_UnSort

Description

This is a pseudo-field name (don't exist a field named Unsort), it's used to set sort criteria, in some cases is useful to set the sort mode with certain sort criteria, and after set to unsort, so the items afterward added will no sorted.

Example

C_SetSortField (F_Unsort)


Title
 F_Title

Syntax

F_Title

Description

Title field

Example

C_MessageBox (Info, F_Title)


Name
 F_Name

Syntax

F_Name

Description

Name field

Example

C_MessageBox (Info, F_Name)


Lastname
 F_Lastname

Syntax

F_Lastname

Description

Name field

Example

C_MessageBox (Info, F_Lastname)


Address
 F_Address

Syntax

F_Address

Description

Address field

Example

C_MessageBox (Info, F_Address)


Memo
 F_Memo

Syntax

F_Memo

Description

Memo field

Example

C_MessageBox (Info, F_Memo)


Company
 F_Company

Syntax

F_Company

Description

Company field


Zip
 F_Zip

Syntax

F_Zip

Description

Zip field


Birth
 F_Birth

Syntax

F_Birth

Description

Birth field


AllRList
 F_AllRList

Syntax

F_AllRList

Description

All Right List fields, this function return a string containing all Right List items.

Any item is followed by a line feed, this means any item is in a separate line.

Example

C_MessageBox (Info, F_AllRList)


RList
 F_RList

Syntax

F_RList (Index)

Parameters

Index: Right List item index

Description

Return the text of item at position Index in Right List; first item is 0

Example

C_MessageBox (Info, F_RList (0) )


RListLabel
 F_RListLabel

Syntax

F_RListLabel (Index)

Parameters

Index: Right List item index

Description

Return the text of the label of item at position Index in Right List; first item is 0

Example

C_MessageBox (Info, F_RListLabel(0) )

See also

C_SetFieldAttr


UniqueID
 F_UniqueID

Syntax

F_UniqueID

Description

Return the Unique ID of selected record

Example

C_MessageBox (Info, F_UniqueID)


NullField
 F_NullField

Syntax

F_NullField

Description

This is a null-field name, used in C_ImportFixChar command

See also

 C_ImportFixChar


Left
 W_Left

Syntax

W_Left

Description

This parameter identify the Left List, it's used in C_ShowWindow and C_HideWindow command

See also

 C_HideWindow  ; C_ShowWindow


Right
 W_Right

Syntax

W_Right

Description

This parameter identify the Right List, it's used in C_ShowWindow and C_HideWindow command

See also

 C_HideWindow  ; C_ShowWindow


SortLocked
 T_SortLocked

Syntax

T_SortLocked

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Sort button when the sort is locked.

See also

 Plugin names and location


SortTitle
 T_SortTitle

Syntax

T_SortTitle

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Sort button when the sort is by title.

See also

 Plugin names and location


SortName
 T_SortName

Syntax

T_SortName

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Sort button when the sort is by name.

See also

 Plugin names and location


SortLastname
 T_SortLastname

Syntax

T_SortLastname

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Sort button when the sort is by lastname.

See also

 Plugin names and location


SortAddress
 T_SortAddress

Syntax

T_SortAddress

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Sort button when the sort is by address.

See also

 Plugin names and location


SortMemo
 T_SortMemo

Syntax

T_SortMemo

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Sort button when the sort is by memo.

See also

 Plugin names and location


SortUniqueID
 T_SortUniqueID

Syntax

T_SortUniqueID

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Sort button when the sort is by Unique ID.

See also

 Plugin names and location


Title
 T_Title

Syntax

T_Title

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Title field.

See also

 Plugin names and location


Name
 T_Name

Syntax

T_Name

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Name field.

See also

 Plugin names and location


Lastname
 T_Lastname

Syntax

T_Lastname

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Lastname field.

See also

 Plugin names and location


Address
 T_Address

Syntax

T_Address

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Address field.

See also

 Plugin names and location


Memo
 T_Memo

Syntax

T_Memo

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Memo field.

See also

 Plugin names and location


Company
 T_Company

Syntax

T_Company

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Company field.

See also

 Plugin names and location


Zip
 T_Zip

Syntax

T_Zip

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Zip field.

See also

 Plugin names and location


Birth
 T_Birth

Syntax

T_Birth

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Birth date field.

See also

 Plugin names and location


ButtAdd
 T_ButtAdd

Syntax

T_ButtAdd

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Add button.

See also

 Plugin names and location


ButtPhone
 T_ButtPhone

Syntax

T_ButtPhone

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Call-Exec button.

See also

 Plugin names and location


RListList
 T_RListList

Syntax

T_RListList

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of Title Right List.

See also

 Plugin names and location


MainList
 T_MainList

Syntax

T_MainList

Description

Title string, used in Automatic Startup plugin (.SUP).

The label of main list (Left List).

See also

 Plugin names and location


 Example 1

This example will create an output of all records of opened DataDuck file, and save it in a file named C:\Delme.TXT; then launch Notepad with this file.

Name, Lastname, and first phone number will be written into the file.

Please note the S_LF terminator.

H_MenuTitle Output test

H_MenuHelp ForEach loop

C_Begin

C_ForEach (C:\Delme.TXT) F_Name, F_Lastname, F_RList(0)S_LF

C_Exec Notepad C:\Delme.TXT

C_End


 Example 2

This example will create an output of all record of opened DataDuck file, and save it in a file named C:\Delme.TXT; then open the print dialog, where you can choose a MSWord template.

Name, Lastname, and first phone number will be written into the file.

Please note the S_LF terminator.

H_MenuTitle Print test

H_MenuHelp ForEach loop and print test

C_Begin

C_ForEach (C:\Delme.TXT) F_Name, F_LastName, F_RList(0)S_LF

C_PrintDosFile (C:\Delme.TXT)

C_End


 Example 3

This example will create an output of filtered records of opened DataDuck file, and save it in a file named C:\Delme.TXT.

The word Jo is used like search filter string.

C_Begin

C_ForEach (C:\Delme.TXT,Jo) F_Name, F_LastName, F_RList(0)S_LF

C_Exec C:\Delme.TXT

C_End


 Example 4

This example will copy Title, Name, Lastname and Address into Clipboard, you can use it to make envelopes.

C_Begin

C_Copy F_Title F_Name F_LastnameS_LFF_Address

C_End


 Example 5

This example demostrate the use of variables.

First you must declare a variable with the C_InitVar command, then you can set a value for it with C_SetVar command, finally you can perform some operation with it.

You can use a variable adding the suffix V_ to variable name

C_Begin

C_InitVar (String, St)

C_SetVar (St, Hello)

C_MessageBox (Info,Var St is now: V_St)

C_Add (V_St, World)

C_MessageBox (Info,Var St is now: V_St)

C_End


 Example 6

This example demostrate the use of Logical Conditions.

A number is request to the user, if the user give a number less than 15, a dialog box will be executed, else another dialog box will be executed.

C_Begin

C_InitVar (Integer, Age)	= 15

C_SetVar (Age, P_AskString (What is your age?,V_Age) )

C_If (Is_EqualOrMinor (V_Age, 15) )

  C_MessageBox (Info,You are young)

C_Else

  C_MessageBox (Info,You aren't a baby)

C_End


 Example 7

This example will create an output file, and put in it some data, then create a new DataDuck file, open the previously created output file, and read data from it.

The Name and Lastname fields will be switched.

C_Begin

// create the output file

C_ForEach (C:\Delme.TXT)F_Name§F_Lastname§

// create a new .PHN file

C_OpenFile()

// import data and switch Name and Lastname

C_ImportFile (C:\Delme.TXT,§) F_Lastname F_Name

C_End